import 'package:floor/floor.dart';
import '../bean/ns_record_bean.dart';

@dao
abstract class NSRecordDao {
  @Insert(onConflict: OnConflictStrategy.replace)
  Future<void> insert(List<NSRecordBean> list);

  @Query("SELECT * FROM NSRecordBean")
  Future<List<NSRecordBean>?> queryAll();

  @Query("SELECT * FROM NSRecordBean where userId = :userId")
  Future<List<NSRecordBean>?> queryByUserId(String userId);

  @Query("SELECT * FROM NSRecordBean where type = :type")
  Future<List<NSRecordBean>?> queryByType(String type);

  @Query("DELETE FROM NSRecordBean")
  Future<void> clearAll();

  @update
  Future<void> updateBean(List<NSRecordBean> bean);

  @delete
  Future<void> deleteBean(NSRecordBean bean);

  @delete
  Future<void> deleteListBean(List<NSRecordBean> bean);
}
